import { request } from '@umijs/max';
export const getUsers = (params) => {
  return request('/api/user', {
    method: 'GET',
    params: {
      ...params,
    },
  });
};
// 修改用户资料
export const editUserApi = (id, data) => {
  return request(`/api/user/${id}`, {
    method: 'PATCH',
    data,
  });
};
// 根据id判断某个用户是否存在
export const isUserExist = (id)=>{
  return request(`/api/user/userIsExist/${id}`)
}

export const addUserApi = (data)=>{
  return request('/api/user',{
    method:"POST",
    data:{
      ...data,
      type:'background'
    }
  })
}

// 根据id拿到某个用户的信息
export const getUserById = (id)=>{
  return request(`/api/user/${id}`)
}

// 删除用户
export const delteUser = (id)=>{
  return request(`/api/user/${id}`,{
    method:'DELETE'
  })
}

